﻿#ifndef C3FDANALYSISTREE_H
#define C3FDANALYSISTREE_H

#include <QTreeWidget>
#include <QTreeWidgetItem>
#include "C3fdLineEdit.h"

class C3fdAnalysisTree : public QTreeWidget
{
	Q_OBJECT
public:
	explicit C3fdAnalysisTree(QWidget *parent = nullptr);

signals:
	void itemNameChanged(QTreeWidgetItem *item, QString oldName, QString newName, QString action);

public slots:
	void addSlot();
	void renameSlot();
	void deleteSlot();
	void finishRenameSlot();

protected:
	virtual void contextMenuEvent(QContextMenuEvent *event) override;
	bool hasSameNameItemInThisLevel(QString name, QTreeWidgetItem *item) const;

private:
	C3fdLineEdit *m_NameEditor = nullptr;
	QTreeWidgetItem *m_CurrentItem = nullptr;
	QString m_Action = "add";	// "add" or "rename" or "delete"
};

#endif